#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>

int main(int argc, char **argv) {
    int size = 1024;
    uint8_t data[size];
    uint8_t data1[size];
    for (int i = 0; i < size; i++)
    {
        data[i] = i;
    }

    char *fname = "example_file.data";
    FILE *fd = fopen(fname, "a+");
    fclose(fd);
    fd = fopen(fname, "r+");
    // fseek(fd, 10, SEEK_SET);
    // int len = fread(data1, 1, 10, fd);
    // printf("read len: %d, head: %x, %x, %x\n", len, data1[0], data1[1], data1[2]);
    fseek(fd, 10, SEEK_SET);
    printf("aa\n");
    fwrite("abc", 1, 3, fd);
    fseek(fd, 1, SEEK_SET);
    fwrite("def", 1, 3, fd);
    int len = ftell(fd);
    printf("len: %d\n", len);
    // fwrite(data, 1, size, fd);
    fclose(fd);
    return 0;
}